import request from '@/utils/request';

export function login(data) {
	return request({
		url: '/login',
		method: 'post',
		data
	});
}
// 退出登录
export function loginOut(data) {
	return request({
		url: '/loginOut',
		method: 'get',
		params: { ...data }
	});
}
export function getUserInfo(token) {
	return request({
		url: '/sysMenu/getSysMenuByLoginUser',
		method: 'get'
		// params: { token }
	});
}

export function logout() {
	return request({
		url: '/vue-admin-template/user/logout',
		method: 'post'
	});
}
// 获取验证码图片
export function getImg(id) {
	return request({
		url: '/login/generateCaptcha/' + id,
		method: 'get',
		responseType: 'blob'
	});
}
// 获取图片ID
export function getImgId() {
	return request({
		url: '/login/generateCaptchaId',
		method: 'get'
	});
}

// 验证码校验
export function checkImg(data) {
	return request({
		url: '/login/validateCaptcha',
		method: 'post',
		data
	});
}

// 判断用户是否为管理员
export function isAdmin(data) {
	return request({
		url: '/sysUser/verifyManage',
		method: 'get',
		data
	});
}

// 获取用户权限信息
export function getPower(data) {
	return request({
		url: '/user/info',
		method: 'get',
		data
	});
}
